<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Spreadsort</title>
<link rel="stylesheet" href="../../../../../../../doc/src/boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
<link rel="home" href="../../../index.html" title="Boost.Sort">
<link rel="up" href="../spreadsort.html" title="2.1.-Spreadsort">
<link rel="prev" href="../spreadsort.html" title="2.1.-Spreadsort">
<link rel="next" href="sort_hpp/integer_sort.html" title="Integer Sort">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr>
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../../boost.png"></td>
<td align="center"><a href="../../../../../../../index.html">Home</a></td>
<td align="center"><a href="../../../../../../../libs/libraries.htm">Libraries</a></td>
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
<td align="center"><a href="../../../../../../../more/index.htm">More</a></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="../spreadsort.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../spreadsort.html"><img src="../../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="sort_hpp/integer_sort.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="sort.single_thread.spreadsort.sort_hpp"></a><a class="link" href="sort_hpp.html" title="Spreadsort">Spreadsort</a>
</h4></div></div></div>
<div class="section">
<div class="titlepage"><div><div><h5 class="title">
<a name="sort.single_thread.spreadsort.sort_hpp.header_spreadsort"></a><a class="link" href="sort_hpp.html#sort.single_thread.spreadsort.sort_hpp.header_spreadsort" title="Header &lt;boost/sort/spreadsort/spreadsort.hpp&gt;">Header
          <code class="computeroutput">&lt;boost/sort/spreadsort/spreadsort.hpp&gt;</code></a>
</h5></div></div></div>
<p>
            <code class="literal"><code class="computeroutput"><a class="link" href="../../../boost/sort/spreadsort/spreadso_idm46498512646896.html" title="Function template spreadsort">spreadsort</a></code></code>
            checks whether the data-type provided is an integer, castable float,
            string, or wstring.
          </p>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
                If data-type is an integer, <code class="literal"><code class="computeroutput"><a class="link" href="../../../boost/sort/spreadsort/integer__idm46498512795392.html" title="Function template integer_sort">integer_sort</a></code></code>
                is used.
              </li>
<li class="listitem">
                If data-type is a float, <code class="literal"><code class="computeroutput"><a class="link" href="../../../boost/sort/spreadsort/float_so_idm46498513989248.html" title="Function template float_sort">float_sort</a></code></code>
                is used.
              </li>
<li class="listitem">
                If data-type is a string or wstring, <code class="literal"><code class="computeroutput"><a class="link" href="../../../boost/sort/spreadsort/string_s_idm46498512563328.html" title="Function template string_sort">string_sort</a></code></code>
                is used.
              </li>
<li class="listitem">
                Sorting other data-types requires picking between <code class="literal"><code class="computeroutput"><a class="link" href="../../../boost/sort/spreadsort/integer__idm46498512795392.html" title="Function template integer_sort">integer_sort</a></code></code>,
                <code class="literal"><code class="computeroutput"><a class="link" href="../../../boost/sort/spreadsort/float_so_idm46498513989248.html" title="Function template float_sort">float_sort</a></code></code>
                and <code class="literal"><code class="computeroutput"><a class="link" href="../../../boost/sort/spreadsort/string_s_idm46498512563328.html" title="Function template string_sort">string_sort</a></code></code>
                directly, as <code class="literal"><code class="computeroutput"><a class="link" href="../../../boost/sort/spreadsort/spreadso_idm46498512646896.html" title="Function template spreadsort">spreadsort</a></code></code>
                won't accept types that don't have the appropriate type traits.
              </li>
</ul></div>
<p>
            Overloading variants are provided that permit use of user-defined right-shift
            functors and comparison functors.
          </p>
<p>
            Each function is optimized for its set of arguments; default functors
            are not provided to avoid the risk of any reduction of performance.
          </p>
<p>
            See <a class="link" href="../../../">overloading</a> section.
          </p>
<h6>
<a name="sort.single_thread.spreadsort.sort_hpp.header_spreadsort.h0"></a>
            <span class="phrase"><a name="sort.single_thread.spreadsort.sort_hpp.header_spreadsort.rationale"></a></span><a class="link" href="sort_hpp.html#sort.single_thread.spreadsort.sort_hpp.header_spreadsort.rationale">Rationale:</a>
          </h6>
<p>
            <code class="literal"><code class="computeroutput"><a class="link" href="../../../boost/sort/spreadsort/spreadso_idm46498512646896.html" title="Function template spreadsort">spreadsort</a></code></code>
            function provides a wrapper that calls the fastest sorting algorithm
            available for a data-type, enabling faster generic programming.
          </p>
<div class="section">
<div class="titlepage"><div><div><h6 class="title">
<a name="sort.single_thread.spreadsort.sort_hpp.header_spreadsort.spreadsort_examples"></a><a class="link" href="sort_hpp.html#sort.single_thread.spreadsort.sort_hpp.header_spreadsort.spreadsort_examples" title="Spreadsort Examples">Spreadsort
            Examples</a>
</h6></div></div></div>
<p>
              See <a href="../../../../../example/" target="_top">example</a> folder for all examples.
            </p>
<p>
              See <a href="../../../../../example/sample.cpp" target="_top">sample.cpp</a> for a
              simple working example.
            </p>
<p>
              For an example of 64-bit integer sorting, see <a href="../../../../../example/int64.cpp" target="_top">int64.cpp</a>.
            </p>
<p>
              This example sets the element type of a vector to 64-bit integer
            </p>
<pre class="programlisting"><span class="preprocessor">#define</span> <span class="identifier">DATA_TYPE</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">int64_t</span>
</pre>
<p>
              and calls the sort
            </p>
<pre class="programlisting"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">sort</span><span class="special">::</span><span class="identifier">spreadsort</span><span class="special">::</span><span class="identifier">spreadsort</span><span class="special">(</span><span class="identifier">array</span><span class="special">.</span><span class="identifier">begin</span><span class="special">(),</span> <span class="identifier">array</span><span class="special">.</span><span class="identifier">end</span><span class="special">());</span>
</pre>
<p>
              For a simple example sorting <code class="computeroutput">float</code>s,
            </p>
<pre class="programlisting">vector&lt;float&gt; vec;
vec.push_back(1.0);
vec.push_back(2.3);
vec.push_back(1.3);
...
spreadsort(vec.begin(), vec.end());
//The sorted vector contains "1.0 1.3 2.3 ..."
</pre>
<p>
              See also <a href="../../../../../example/floatsample.cpp" target="_top">floatsample.cpp</a>
              which checks for abnormal values.
            </p>
</div>
</div>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
<td align="right"><div class="copyright-footer">Copyright © 2014-2017 Steven
      Ross, Francisco Tapia, Orson Peters<p>
        Distributed under the <a href="http://boost.org/LICENSE_1_0.txt" target="_top">Boost
        Software License, Version 1.0</a>.
      </p>
</div></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="../spreadsort.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../spreadsort.html"><img src="../../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="sort_hpp/integer_sort.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
</body>
</html>
